home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
boe.pres.k12.wv.us
/
boe.pres.k12.wv.us.zip
/
boe.pres.k12.wv.us
/
Utilities
/
Xerox Workcentre 5335
/
Windows Scan
/
32-bit_x86
/
Francais
/
cpsimage.cab
/
data
/
docio
/
findchecksums.elf
< prev
next >
Wrap
Text File
|
2009-03-16
|
2KB
|
76 lines
// ELF script that checksums for all files in a directory
/* @findchecksums
// DESCRIPTION
A utility to report the checksum(s) of a file or directory of files.
// PARAMETERS
The following parameters may be used:
STRING source - The name of a file or directory. This is required. Given a file,
this script will report its checksum using the DOCUMENTREADER. Given a directory,
this script will report checksums for every file it can.
*/
/**********************************************************************************/
/***************************** SCRIPT ENTRY *************************************/
/**********************************************************************************/
#import "documentio.ucm";
#load "sys/stdio.elf";
LoadClasses(filename:"xeng");
IMPORT STRING source;
if (!source) {
print "findchecksums: A source is required.";
return;
}
FILE sourceFILE;
sourceFILE= new(FILE, path: source);
if (sourceFILE.exists() == FALSE) {
print "findchecksums: Not able to find "+source;
return;
}
LIST files;
if (sourceFILE.isDirectory() == TRUE) {
files = sourceFILE.listFiles();
} else if (sourceFILE.exists() == TRUE) {
files.insert(entry: 0, obj:sourceFILE);
}
INTEGER fileCount = files.length();
if (fileCount < 1) {
print "findchecksums: Zero files found in " + source;
return;
}
DOCUMENTREADER tdr;
INTEGER iLoop;
FILE curFile;
STRING fname;
STRING format;
INTEGER pageCount = 0;
INTEGER sum;
for (iLoop = limit; iLoop < fileCount; iLoop++) {
curFile = files[iLoop];
fname = curFile.getName();
tdr = CreateDocumentReader(filename: curFile.getCanonicalPath() );
if (tdr) {
pageCount = tdr.getPageCount();
sum = tdr.getChecksum();
tdr.getFormat() Returns(format: format);
tdr.release();
} else {
pageCount = 0;
sum = 0;
format = "unknown";
}
print fname+" fmt = "+format+" pgs = "+pageCount+" pgs = "+sum;
}
return;